<template>
  <div class="full-box shadow-box padding-box">
    <OperateCommon :showSearch="true" :showAdd="false" @search="initData">
      <template #condition>
        <div class="condition-item">
          <el-select
            v-model="queryParams.status"
            value-key=""
            placeholder=""
            clearable
            filterable
          >
            <el-option :key="-1" label="全部" value=""></el-option>
            <el-option :key="0" label="未交办" :value="0"></el-option>
            <el-option :key="10" label="已交办" :value="10"></el-option>
            <el-option :key="15" label="交办退回" :value="15"></el-option>
            <el-option :key="20" label="待处置" :value="20"></el-option>
            <el-option :key="100" label="已处置" :value="100"></el-option>
          </el-select>
        </div>
      </template>
    </OperateCommon>
    <div class="table-wrapper">
      <BaseTable
        :columns="columns"
        :showSort="true"
        :tableData="tableData"
        :pages="{
          show: true,
          count: count,
        }"
        :operate="{
          show: true,
          width: 200,
        }"
        @pagination="pageChange"
      >
        <template #operate="{ current }">
          <el-button type="primary" size="mini" @click="linkWhere(current.row)"
            >详情</el-button
          >
          <!-- <el-button
            type="danger"
            size="mini"
            @click="deleteConfirm(current.row.id)"
            >删除</el-button
          > -->
        </template>
      </BaseTable>
    </div>
  </div>
</template>

<script>
import BaseTable from "@/components/Common/BaseTable.vue";
import OperateCommon from "@/components/Common/OperateCommon.vue";
import { getTransferList } from "@/api/QuestionTransfer/Index";
import LinkTo from "@/mixins/LinkTo";
import commonList from "@/mixins/commonList";
export default {
  mixins: [LinkTo, commonList],
  components: { BaseTable, OperateCommon },
  data() {
    return {
      columns: columns,
      tableData: [],
      count: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        status: 0,
      },
    };
  },
  methods: {
    initData() {
      getTransferList(this.queryParams).then((res) => {
        if (res.code == 0) {
          this.tableData = res.data;
        }
      });
    },
    pageChange(val) {
      this.queryParams.pageNum = val.pageNum;
      this.queryParams.pageSize = val.pageSize;
      this.initData();
    },
    deleteConfirm(id) {
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.deleteItem(id);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    deleteItem(id) {
      deleteDept({ id: id }).then((res) => {
        if (res.code == 0) {
          this.$message.success("删除成功");
          this.initData();
        }
      });
    },
    linkWhere(item) {
      this.linkTo(`/problemTransfer/details/${item.id}/0`);
    },
  },
  created() {
    this.initData();
  },
};

const columns = [
  {
    prop: "problem",
    label: "问题描述",
    width: "",
    minWidth: "300",
    align: "",
  },
  {
    prop: "dept_name",
    label: "移交单位",
    width: "",
    minWidth: "200",
    align: "",
  },
  {
    prop: "transfer_time",
    label: "移交时间",
    width: "150",
    minWidth: "",
    align: "",
  },
  {
    prop: "status_text",
    label: "交办状态",
    width: "100",
    minWidth: "",
    align: "",
  },
  {
    prop: "assign_date",
    label: "交办时间",
    width: "150",
    minWidth: "",
    align: "",
  },
];
</script>

<style lang="scss" scoped>
</style>